package com.qingsong.entity.table;

import com.mybatisflex.core.query.QueryColumn;
import com.mybatisflex.core.table.TableDef;


/**
 * 季次表 表定义层。
 *
 * @author qingsong
 * @since 2024-12-22
 */
public class SeasonTableDef extends TableDef {

    private static final long serialVersionUID = 1L;

    /**
     * 季次表
     */
    public static final SeasonTableDef SEASON = new SeasonTableDef();

    /**
     * 主键
     */
    public final QueryColumn ID = new QueryColumn(this, "id");

    /**
     * 序号
     */
    public final QueryColumn IDX = new QueryColumn(this, "idx");

    /**
     * 描述
     */
    public final QueryColumn INFO = new QueryColumn(this, "info");

    /**
     * 标题
     */
    public final QueryColumn TITLE = new QueryColumn(this, "title");

    /**
     * 创建时间
     */
    public final QueryColumn CREATED = new QueryColumn(this, "created");

    /**
     * 逻辑删除,0未删除,1已删除
     */
    public final QueryColumn DELETED = new QueryColumn(this, "deleted");

    /**
     * 修改时间
     */
    public final QueryColumn UPDATED = new QueryColumn(this, "updated");

    /**
     * 数据版本
     */
    public final QueryColumn VERSION = new QueryColumn(this, "version");

    /**
     * 课程表ID
     */
    public final QueryColumn FK_COURSE_ID = new QueryColumn(this, "fk_course_id");

    /**
     * 所有字段。
     */
    public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");

    /**
     * 默认字段，不包含逻辑删除或者 large 等字段。
     */
    public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, TITLE, FK_COURSE_ID, IDX, INFO, VERSION, CREATED, UPDATED};

    public SeasonTableDef() {
        super("ml_cms", "season");
    }

    private SeasonTableDef(String schema, String name, String alisa) {
        super(schema, name, alisa);
    }

    public SeasonTableDef as(String alias) {
        String key = getNameWithSchema() + "." + alias;
        return getCache(key, k -> new SeasonTableDef("ml_cms", "season", alias));
    }

}
